<?php

namespace plugins\yifang_backend_account\utils\tool;

class Rand
{
    /**
     * 获取随机字符串
     * @param int $length
     * @return string
     */
    public function generateRandomString($minLen = 5, $maxLen = 10)
    {
        $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $charactersLength = strlen($characters);
        $randomString = '';
        foreach (range(1, rand($minLen, $maxLen)) as $i) {
            $randomString .= $characters[rand(0, $charactersLength - 1)];
        }
        return $randomString;
    }
}